<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Navo Portable Library: navo/port/swab.h源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Navo Portable Library&#160;<span id="projectnumber">Ver 1.0.20120827</span></div>
   <div id="projectbrief">Provides generic platform independent facilities.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>数据结构</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>navo/port/swab.h</h1>  </div>
</div>
<div class="contents">
<a href="swab_8h.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* #ifdef _MSC_VER */</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef __NV_SWAB__</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define __NV_SWAB__</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="cdef_8h.html" title="Definitions and declarations for common constants, types, variables.">cdef.h</a>&quot;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="compiler_8h.html" title="Compiler.">compiler.h</a>&quot;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &quot;<a class="code" href="arch_8h.html" title="Architecture.">arch.h</a>&quot;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &quot;<a class="code" href="integer_8h.html" title="Provides standard integer types.">integer.h</a>&quot;</span>
<a name="l00022"></a>00022 
<a name="l00034"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaae236871f4e50651f1bad0f87b2605dd">00034</a> <span class="preprocessor">#define __bswap16_c(c) ((uint16_t)( \</span>
<a name="l00035"></a>00035 <span class="preprocessor">    (((c) &amp; 0x00FF) &lt;&lt; 8) |     \</span>
<a name="l00036"></a>00036 <span class="preprocessor">    (((c) &amp; 0xFF00) &gt;&gt; 8)))</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00043"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga0fbe88ab3255a21f59866154584e14b3">00043</a> <span class="preprocessor">#define __bswap32_c(c) ((uint32_t)( \</span>
<a name="l00044"></a>00044 <span class="preprocessor">    (((c) &amp; 0x000000FFUL) &lt;&lt; 24) | \</span>
<a name="l00045"></a>00045 <span class="preprocessor">    (((c) &amp; 0x0000FF00UL) &lt;&lt;  8) | \</span>
<a name="l00046"></a>00046 <span class="preprocessor">    (((c) &amp; 0x00FF0000UL) &gt;&gt;  8) | \</span>
<a name="l00047"></a>00047 <span class="preprocessor">    (((c) &amp; 0xFF000000UL) &gt;&gt; 24)))</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span>
<a name="l00055"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga4b3303af97041fe45a956e45148771bd">00055</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga4b3303af97041fe45a956e45148771bd" title="反转16位整数">__bswap16</a>(uint16_t x)
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaae236871f4e50651f1bad0f87b2605dd" title="16位常量字序反转">__bswap16_c</a>(x);
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059 
<a name="l00066"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2e098b2765e233a829926df6e55f6c7b">00066</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2e098b2765e233a829926df6e55f6c7b" title="反转32位整数">__bswap32</a>(uint32_t x)
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068 <span class="preprocessor">#if defined(NV_ARCH_X86) || defined(NV_ARCH_X64) || defined(NV_ARCH_IA64)</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#ifdef __GNUC__</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span>    __asm__(<span class="stringliteral">&quot;bswap %0&quot;</span> : <span class="stringliteral">&quot;=r&quot;</span> (x) : <span class="stringliteral">&quot;0&quot;</span> (x));
<a name="l00071"></a>00071     <span class="keywordflow">return</span> x;
<a name="l00072"></a>00072 <span class="preprocessor">#elif defined(_MSC_VER)</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span>    __asm push eax
<a name="l00074"></a>00074     __asm mov eax, x
<a name="l00075"></a>00075     __asm bswap eax
<a name="l00076"></a>00076     __asm mov x, eax
<a name="l00077"></a>00077     __asm pop eax
<a name="l00078"></a>00078     <span class="keywordflow">return</span> x;
<a name="l00079"></a>00079 <span class="preprocessor">#else</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span>    <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga0fbe88ab3255a21f59866154584e14b3" title="32位常量字序反转">__bswap32_c</a>(x);
<a name="l00081"></a>00081 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __GNUC__ */</span>
<a name="l00082"></a>00082 <span class="preprocessor">#elif defined(__GNUC__)</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_bswap32(x);
<a name="l00084"></a>00084 <span class="preprocessor">#else</span>
<a name="l00085"></a>00085 <span class="preprocessor"></span>    <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga0fbe88ab3255a21f59866154584e14b3" title="32位常量字序反转">__bswap32_c</a>(x);
<a name="l00086"></a>00086 <span class="preprocessor">#endif </span><span class="comment">/* #if defined(NV_ARCH_X86) || defined(NV_ARCH_X64) */</span>
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 
<a name="l00095"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2f436bfcc47e2d2cf6d7aa5d01ab6ee1">00095</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2f436bfcc47e2d2cf6d7aa5d01ab6ee1" title="反转16位整数">__bswap16_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00096"></a>00096 {
<a name="l00097"></a>00097     uint16_t x = *((uint16_t*)p);
<a name="l00098"></a>00098     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaae236871f4e50651f1bad0f87b2605dd" title="16位常量字序反转">__bswap16_c</a>(x);
<a name="l00099"></a>00099 }
<a name="l00100"></a>00100 
<a name="l00107"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga6d63ed99d6ea7aae649f79e8dec32a02">00107</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga6d63ed99d6ea7aae649f79e8dec32a02" title="反转32位整数">__bswap32_p</a>(<span class="keywordtype">void</span>* p)
<a name="l00108"></a>00108 {
<a name="l00109"></a>00109     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2e098b2765e233a829926df6e55f6c7b" title="反转32位整数">__bswap32</a>(*((uint32_t*)p));
<a name="l00110"></a>00110 }
<a name="l00111"></a>00111 
<a name="l00117"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga4930f71c9e50a84b6d2a24baa02b387b">00117</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga4930f71c9e50a84b6d2a24baa02b387b" title="反转16位整数，并存回内存">__bswap16_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00118"></a>00118 {
<a name="l00119"></a>00119     uint16_t x = *((uint16_t*)p);
<a name="l00120"></a>00120     *((uint16_t*)p) = <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaae236871f4e50651f1bad0f87b2605dd" title="16位常量字序反转">__bswap16_c</a>(x);
<a name="l00121"></a>00121 }
<a name="l00122"></a>00122 
<a name="l00128"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga99ca66292d457329a6cb4bf392baf38e">00128</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga99ca66292d457329a6cb4bf392baf38e" title="反转32位整数，并存回内存">__bswap32_s</a>(<span class="keywordtype">void</span>* p)
<a name="l00129"></a>00129 {
<a name="l00130"></a>00130     *((uint32_t*)p) = <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2e098b2765e233a829926df6e55f6c7b" title="反转32位整数">__bswap32</a>(*((uint32_t*)p));
<a name="l00131"></a>00131 }
<a name="l00132"></a>00132 
<a name="l00139"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga0193b1ae5f6bf7d9f03e96a9125d0fb2">00139</a> <span class="preprocessor">#define __bswap16_array(b, c) do {          \</span>
<a name="l00140"></a>00140 <span class="preprocessor">        uint16_t* _sw_b = (uint16_t*)(b);   \</span>
<a name="l00141"></a>00141 <span class="preprocessor">        size_t _sw_c = (c);                 \</span>
<a name="l00142"></a>00142 <span class="preprocessor">        while (_sw_c--) {                   \</span>
<a name="l00143"></a>00143 <span class="preprocessor">            __bswap16_s(_sw_b++);           \</span>
<a name="l00144"></a>00144 <span class="preprocessor">        }                                   \</span>
<a name="l00145"></a>00145 <span class="preprocessor">    } while (0)</span>
<a name="l00146"></a>00146 <span class="preprocessor"></span>
<a name="l00153"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2bdde55ff2a939c8ac42943b5a3a3a09">00153</a> <span class="preprocessor">#define __bswap32_array(b, c) do {          \</span>
<a name="l00154"></a>00154 <span class="preprocessor">        uint32_t* _sw_b = (uint32_t*)(b);   \</span>
<a name="l00155"></a>00155 <span class="preprocessor">        size_t _sw_c = (c);                 \</span>
<a name="l00156"></a>00156 <span class="preprocessor">        while (_sw_c--) {                   \</span>
<a name="l00157"></a>00157 <span class="preprocessor">            __bswap32_s(_sw_b++);           \</span>
<a name="l00158"></a>00158 <span class="preprocessor">        }                                   \</span>
<a name="l00159"></a>00159 <span class="preprocessor">    } while (0)</span>
<a name="l00160"></a>00160 <span class="preprocessor"></span>
<a name="l00179"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gab2c46740f2056a01d376fe7e7f77ea03">00179</a> <span class="preprocessor">#define __rol16_c(c, b) (((uint16_t)(c) &lt;&lt; (b)) | ((uint16_t)(c) &gt;&gt; (16 - (b))))</span>
<a name="l00180"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga50d65c0c6678d0fbd94534455d3f45ff">00180</a> <span class="preprocessor"></span><span class="preprocessor">#define __ror16_c(c, b) (((uint16_t)(c) &gt;&gt; (b)) | ((uint16_t)(c) &lt;&lt; (16 - (b))))</span>
<a name="l00181"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga1a632456e03ca94789e3ffa87f2512b1">00181</a> <span class="preprocessor"></span><span class="preprocessor">#define __rol32_c(c, b) (((uint32_t)(c) &lt;&lt; (b)) | ((uint32_t)(c) &gt;&gt; (32 - (b))))</span>
<a name="l00182"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga06418644f153e40de93661756cb7d832">00182</a> <span class="preprocessor"></span><span class="preprocessor">#define __ror32_c(c, b) (((uint32_t)(c) &gt;&gt; (b)) | ((uint32_t)(c) &lt;&lt; (32 - (b))))</span>
<a name="l00183"></a>00183 <span class="preprocessor"></span>
<a name="l00192"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2847789509cbadd983a367ae1a080689">00192</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2847789509cbadd983a367ae1a080689" title="左旋转16位整数b位">__rol16</a>(uint16_t v, <span class="keywordtype">int</span> b)
<a name="l00193"></a>00193 {
<a name="l00194"></a>00194     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gab2c46740f2056a01d376fe7e7f77ea03" title="左旋转16位整型常量">__rol16_c</a>(v, b);
<a name="l00195"></a>00195 }
<a name="l00196"></a>00196 
<a name="l00205"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga21439f310376edf5bcc2d563ff56e065">00205</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga21439f310376edf5bcc2d563ff56e065" title="右旋转16位整数b位">__ror16</a>(uint16_t v, <span class="keywordtype">int</span> b)
<a name="l00206"></a>00206 {
<a name="l00207"></a>00207     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga50d65c0c6678d0fbd94534455d3f45ff" title="右旋转16位整型常量">__ror16_c</a>(v, b);
<a name="l00208"></a>00208 }
<a name="l00209"></a>00209 
<a name="l00218"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga5c40024969f5f66c871e34d8150685d2">00218</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga5c40024969f5f66c871e34d8150685d2" title="左旋转32位整数b位">__rol32</a>(uint32_t v, <span class="keywordtype">int</span> b)
<a name="l00219"></a>00219 {
<a name="l00220"></a>00220     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga1a632456e03ca94789e3ffa87f2512b1" title="左旋转32位整型常量">__rol32_c</a>(v, b);
<a name="l00221"></a>00221 }
<a name="l00222"></a>00222 
<a name="l00231"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaa5c40c056c3a176e3fe842399a04dc0a">00231</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaa5c40c056c3a176e3fe842399a04dc0a" title="右旋转32位整数b位">__ror32</a>(uint32_t v, <span class="keywordtype">int</span> b)
<a name="l00232"></a>00232 {
<a name="l00233"></a>00233     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga06418644f153e40de93661756cb7d832" title="右旋转32位整型常量">__ror32_c</a>(v, b);
<a name="l00234"></a>00234 }
<a name="l00235"></a>00235 
<a name="l00244"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga1bdddce5fc92cdc25ca5648270acea58">00244</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga1bdddce5fc92cdc25ca5648270acea58" title="左旋转指定内存地址的16位整数b位，但不存回p">__rol16_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00245"></a>00245 {
<a name="l00246"></a>00246     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2847789509cbadd983a367ae1a080689" title="左旋转16位整数b位">__rol16</a>(*((uint16_t*)p), b);
<a name="l00247"></a>00247 }
<a name="l00248"></a>00248 
<a name="l00257"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaa4eae4244bb96c289e6cf7c3f471e773">00257</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint16_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaa4eae4244bb96c289e6cf7c3f471e773" title="右旋转指定内存地址的16位整数b位，但不存回p">__ror16_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00258"></a>00258 {
<a name="l00259"></a>00259     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga21439f310376edf5bcc2d563ff56e065" title="右旋转16位整数b位">__ror16</a>(*((uint16_t*)p), b);
<a name="l00260"></a>00260 }
<a name="l00261"></a>00261 
<a name="l00270"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga571cb6f4a32a781a7d0fd1351ce1df74">00270</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga571cb6f4a32a781a7d0fd1351ce1df74" title="左旋转指定内存地址的32位整数b位，但不存回p">__rol32_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00271"></a>00271 {
<a name="l00272"></a>00272     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga5c40024969f5f66c871e34d8150685d2" title="左旋转32位整数b位">__rol32</a>(*((uint32_t*)p), b);
<a name="l00273"></a>00273 }
<a name="l00274"></a>00274 
<a name="l00283"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gad0b7e432975a3d1e23b8d89ec86bfbb8">00283</a> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gad0b7e432975a3d1e23b8d89ec86bfbb8" title="右旋转指定内存地址的32位整数b位，但不存回p">__ror32_p</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00284"></a>00284 {
<a name="l00285"></a>00285     <span class="keywordflow">return</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaa5c40c056c3a176e3fe842399a04dc0a" title="右旋转32位整数b位">__ror32</a>(*((uint32_t*)p), b);
<a name="l00286"></a>00286 }
<a name="l00287"></a>00287 
<a name="l00295"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga23080d1479b25f51311237ad320c1d26">00295</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga23080d1479b25f51311237ad320c1d26" title="左旋转指定内存地址的16位整数b位，并存回p">__rol16_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00296"></a>00296 {
<a name="l00297"></a>00297     *((uint16_t*)p) = <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga2847789509cbadd983a367ae1a080689" title="左旋转16位整数b位">__rol16</a>(*((uint16_t*)p), b);
<a name="l00298"></a>00298 }
<a name="l00299"></a>00299 
<a name="l00307"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaba97992d294cad7030656a17590a40f4">00307</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaba97992d294cad7030656a17590a40f4" title="右旋转指定内存地址的16位整数b位，并存回p">__ror16_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00308"></a>00308 {
<a name="l00309"></a>00309     *((uint16_t*)p) = <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga21439f310376edf5bcc2d563ff56e065" title="右旋转16位整数b位">__ror16</a>(*((uint16_t*)p), b);
<a name="l00310"></a>00310 }
<a name="l00311"></a>00311 
<a name="l00319"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga7d8f36acc41ae727056012b8da610f19">00319</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga7d8f36acc41ae727056012b8da610f19" title="左旋转指定内存地址的32位整数b位，并存回p">__rol32_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00320"></a>00320 {
<a name="l00321"></a>00321     *((uint32_t*)p) = <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga5c40024969f5f66c871e34d8150685d2" title="左旋转32位整数b位">__rol32</a>(*((uint32_t*)p), b);
<a name="l00322"></a>00322 }
<a name="l00323"></a>00323 
<a name="l00331"></a><a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga9280be6ac5803191222650648274c86b">00331</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#ga9280be6ac5803191222650648274c86b" title="右旋转指定内存地址的32位整数b位，并存回p">__ror32_s</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00332"></a>00332 {
<a name="l00333"></a>00333     *((uint32_t*)p) = <a class="code" href="group___xE4_xBA_xA4_xE6_x8D_xA2_xE5_xAD_x97_xE5_xBA_x8F.html#gaa5c40c056c3a176e3fe842399a04dc0a" title="右旋转32位整数b位">__ror32</a>(*((uint32_t*)p), b);
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 
<a name="l00336"></a>00336 <span class="preprocessor">#ifdef INT64_SUPPORT</span>
<a name="l00337"></a>00337 <span class="preprocessor"></span>
<a name="l00343"></a>00343 <span class="preprocessor">#define __bswap64_c(c) ((uint64_t)(             \</span>
<a name="l00344"></a>00344 <span class="preprocessor">    (((c) &amp; UINT64_C(0x00000000000000FF)) &lt;&lt; 56) | \</span>
<a name="l00345"></a>00345 <span class="preprocessor">    (((c) &amp; UINT64_C(0x000000000000FF00)) &lt;&lt; 40) | \</span>
<a name="l00346"></a>00346 <span class="preprocessor">    (((c) &amp; UINT64_C(0x0000000000FF0000)) &lt;&lt; 24) | \</span>
<a name="l00347"></a>00347 <span class="preprocessor">    (((c) &amp; UINT64_C(0x00000000FF000000)) &lt;&lt;  8) | \</span>
<a name="l00348"></a>00348 <span class="preprocessor">    (((c) &amp; UINT64_C(0x000000FF00000000)) &gt;&gt;  8) | \</span>
<a name="l00349"></a>00349 <span class="preprocessor">    (((c) &amp; UINT64_C(0x0000FF0000000000)) &gt;&gt; 24) | \</span>
<a name="l00350"></a>00350 <span class="preprocessor">    (((c) &amp; UINT64_C(0x00FF000000000000)) &gt;&gt; 40) | \</span>
<a name="l00351"></a>00351 <span class="preprocessor">    (((c) &amp; UINT64_C(0xFF00000000000000)) &gt;&gt; 56)))</span>
<a name="l00352"></a>00352 <span class="preprocessor"></span>
<a name="l00359"></a>00359 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __bswap64(uint64_t x)
<a name="l00360"></a>00360 {
<a name="l00361"></a>00361 <span class="preprocessor">#ifdef __GNUC__</span>
<a name="l00362"></a>00362 <span class="preprocessor"></span><span class="preprocessor">#if defined(NV_ARCH_X64) || defined(NV_ARCH_IA64)</span>
<a name="l00363"></a>00363 <span class="preprocessor"></span>    __asm__(<span class="stringliteral">&quot;bswapq %0&quot;</span> : <span class="stringliteral">&quot;=r&quot;</span> (x) : <span class="stringliteral">&quot;0&quot;</span> (x));
<a name="l00364"></a>00364     <span class="keywordflow">return</span> x;
<a name="l00365"></a>00365 <span class="preprocessor">#else</span>
<a name="l00366"></a>00366 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __builtin_bswap64(x);
<a name="l00367"></a>00367 <span class="preprocessor">#endif </span><span class="comment">/* #if defined(NV_ARCH_X64) || defined(NV_ARCH_IA64) */</span>
<a name="l00368"></a>00368 <span class="preprocessor">#else</span>
<a name="l00369"></a>00369 <span class="preprocessor"></span>    <span class="keywordflow">return</span> __bswap64_c(x);
<a name="l00370"></a>00370 <span class="preprocessor">#endif </span><span class="comment">/* #if defined(__GNUC__) &amp;&amp; (...... */</span>
<a name="l00371"></a>00371 }
<a name="l00372"></a>00372 
<a name="l00379"></a>00379 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __bswap64_p(<span class="keywordtype">void</span>* p)
<a name="l00380"></a>00380 {
<a name="l00381"></a>00381     <span class="keywordflow">return</span> __bswap64(*((uint64_t*)p));
<a name="l00382"></a>00382 }
<a name="l00383"></a>00383 
<a name="l00389"></a>00389 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __bswap64_s(<span class="keywordtype">void</span>* p)
<a name="l00390"></a>00390 {
<a name="l00391"></a>00391     *((uint64_t*)p) = __bswap64(*((uint64_t*)p));
<a name="l00392"></a>00392 }
<a name="l00393"></a>00393 
<a name="l00400"></a>00400 <span class="preprocessor">#define __bswap64_array(b, c) do {          \</span>
<a name="l00401"></a>00401 <span class="preprocessor">        uint64_t* _sw_b = (uint64_t*)(b);   \</span>
<a name="l00402"></a>00402 <span class="preprocessor">        size_t _sw_c = (c);                 \</span>
<a name="l00403"></a>00403 <span class="preprocessor">        while (_sw_c--) {                   \</span>
<a name="l00404"></a>00404 <span class="preprocessor">            __bswap64_s(_sw_b++);           \</span>
<a name="l00405"></a>00405 <span class="preprocessor">        }                                   \</span>
<a name="l00406"></a>00406 <span class="preprocessor">    } while (0)</span>
<a name="l00407"></a>00407 <span class="preprocessor"></span>
<a name="l00418"></a>00418 <span class="preprocessor">#define __rol64_c(c, b) (((uint64_t)(c) &lt;&lt; (b)) | ((uint64_t)(c) &gt;&gt; (64 - (b))))</span>
<a name="l00419"></a>00419 <span class="preprocessor"></span><span class="preprocessor">#define __ror64_c(c, b) (((uint64_t)(c) &gt;&gt; (b)) | ((uint64_t)(c) &lt;&lt; (64 - (b))))</span>
<a name="l00420"></a>00420 <span class="preprocessor"></span>
<a name="l00428"></a>00428 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __rol64(uint64_t v, <span class="keywordtype">int</span> b)
<a name="l00429"></a>00429 {
<a name="l00430"></a>00430     <span class="keywordflow">return</span> __rol64_c(v, b);
<a name="l00431"></a>00431 }
<a name="l00432"></a>00432 
<a name="l00440"></a>00440 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __ror64(uint64_t v, <span class="keywordtype">int</span> b)
<a name="l00441"></a>00441 {
<a name="l00442"></a>00442     <span class="keywordflow">return</span> __rol64_c(v, b);
<a name="l00443"></a>00443 }
<a name="l00444"></a>00444 
<a name="l00445"></a>00445 
<a name="l00454"></a>00454 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __rol64_p(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00455"></a>00455 {
<a name="l00456"></a>00456     <span class="keywordflow">return</span> __rol64(*((uint64_t*)p), b);
<a name="l00457"></a>00457 }
<a name="l00458"></a>00458 
<a name="l00467"></a>00467 <span class="keyword">static</span> <span class="keyword">inline</span> uint64_t __ror64_p(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00468"></a>00468 {
<a name="l00469"></a>00469     <span class="keywordflow">return</span> __ror64(*((uint64_t*)p), b);
<a name="l00470"></a>00470 }
<a name="l00471"></a>00471 
<a name="l00479"></a>00479 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __rol64_s(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00480"></a>00480 {
<a name="l00481"></a>00481     *((uint64_t*)p) = __rol64(*((uint64_t*)p), b);
<a name="l00482"></a>00482 }
<a name="l00483"></a>00483 
<a name="l00491"></a>00491 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> __ror64_s(<span class="keywordtype">void</span>* p, <span class="keywordtype">int</span> b)
<a name="l00492"></a>00492 {
<a name="l00493"></a>00493     *((uint64_t*)p) = __ror64(*((uint64_t*)p), b);
<a name="l00494"></a>00494 }
<a name="l00495"></a>00495 
<a name="l00496"></a>00496 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef INT64_SUPPORT */</span>
<a name="l00497"></a>00497 
<a name="l00500"></a>00500 <span class="preprocessor">#endif </span><span class="comment">/* #ifndef __NV_SWAB__ */</span>
<a name="l00501"></a>00501 
<a name="l00502"></a>00502 
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>数据结构</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2015年七月16日 星期四 12:00:38 for Navo Portable Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
